import React from 'react';
import ListItem from '@/components/ListItem';
import { Empty } from 'antd';
import './index.css';
class ArticleList extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
        list:[]
    };
  }
  componentWillReceiveProps(nextProps){
    this.setState({
        list:nextProps.list
    })
  }
  render() {
      const {list}=this.state
      if (list.length) {
        return (
            <div className='articleList'>
              {
                  list.map((e) => (
                    <ListItem data={e}></ListItem>
                  ))
              }
            </div>
          );
      } else {
          return <div className='articleList'><Empty description='暂无数据'></Empty></div>
      }
    
  }
}
export default ArticleList;
